<template>
  <div class="left-atlas-container">
    <div class="left-atlas-container-item">
        <div class="title">
            <span>动漫</span>
            <span>更多</span>
        </div>

        <div class="out-container" v-for="(item, index) in atlasList" :key="index">
            <div class="info" v-for="(itemChildren, indexChildren) in item" :key="indexChildren" @click="goToDetailsPage(itemChildren.name)">
                <!-- 图片模块 -->
                <div class="image">
                    <!-- <img src="https://lz.sinaimg.cn/large/008w3CKjgy1hwv4iza7jej307i0al75l.jpg" /> -->
                    <img :src="itemChildren.url" alt=""/>
                    <div>最新9集</div>
                </div>

                <!-- 简介 -->
                <span class="desc">{{ itemChildren.title }}</span>
            </div>
        </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";

import router from '../../../router/index';
import { atlasClassification } from '../../../assets/constant';

const atlasList = ref([]);

const goToDetailsPage = (name) => {
    router.push({path: '/details', query: { name }});
}

onMounted(() => {
    atlasList.value = atlasClassification;
});
</script>

<style lang="less" scoped>
.left-atlas-container {
    padding: 20px 30px 0;
    width: 70%;
    .left-atlas-container-item {
        width: 100%;
        .title {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            span {
                font-size: 20px;
                color: #fff;
            }
        }
        .out-container {
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
        }
        .info {
            display: flex;
            flex-direction: column;
            justify-content: center;
            float: left;
            width: 200px;
            .image {
                width: 200px;
                height: 300px;
                position: relative;
                img {
                    width: 100%;
                    height: 100%;
                }
                div {
                    position: absolute;
                    bottom: 0;
                    width: 200px;
                    height: 30px;
                    box-sizing: border-box;
                    background-color: rgba(0, 0, 0, 0.5);
                    color: #fff;
                    display: flex;
                    justify-content: flex-end;
                    align-items: center;
                    padding-right: 10px;
                }
            }
            .desc {
                font-size: 16px;
                color: #f90;
                margin-top: 5px;
            }
        }
    }
}
</style>